<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Insert title here</title>
		<!--框架必需start-->
		<script type="text/javascript" src="../../libs/js/jquery.js"></script>
		<script type="text/javascript" src="../../libs/js/framework.js"></script>
		<link href="../../libs/css/import_basic.css" rel="stylesheet"
			type="text/css" />
		<link rel="stylesheet" type="text/css" id="skin" prePath="../../" />
		<link rel="stylesheet" type="text/css" id="customSkin" />
		<!--框架必需end-->
		<!-- 表单验证start -->
		<script src="../../libs/js/form/validationRule.js"
			type="text/javascript"></script>
		<script src="../../libs/js/form/validation.js" type="text/javascript"></script>
		<!-- 表单验证end -->
		<!-- 日期选择框start -->
		<script type="text/javascript" src="../../libs/js/form/datePicker/WdatePicker.js"></script>
		<!-- 日期选择框end -->
		<!-- ueditor -->
		<script type="text/javascript">
		<!--
			window.UEDITOR_HOME_URL = '<%=request.getContextPath()%>/ueditor/';
		-->
		</script>
		<script type="text/javascript" src="../../ueditor/editor_config.js"></script>
		<script type="text/javascript" src="../../ueditor/editor.js"></script>
		<link rel="stylesheet" href="../../ueditor/themes/default/ueditor.css" />
				
		<!-- swfupload -->
		<link href="../../swfupload/css/swfupload-default.css" rel="stylesheet"type="text/css" />
		<script type="text/javascript" src="../../swfupload/js/swfupload.js"></script>
		<script type="text/javascript" src="../../swfupload/js/handlers.js"></script>
		<style type="text/css">
			.imgBox{
				width:720px;
				border:1px solid #CCCCCC;
				padding: 10px 0 10px 0;
			}
			#imgList{
				display:block;
				margin: 10px;
				
			}
			#imgList div{
				position:relative;
				padding:10px;
				display:block;
				width: 150px;
				height: 120px;
				float: left;
			}
			#imgList img{
				width: 100%;
			}
			#imgList p{
				margin:0;
				width:20px;
				height:20px;
				position: absolute;
				right: 0;
				top: 0;
				cursor: pointer;
			}
			#imgList span {
				background:#FFFFFF;
				position:absolute;
				bottom: 0;
				left:0;
				width:100%;
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div id="scrollContent">
		<div class = "box1" panelWidth = "800">
			<fieldset>
				<legend>编辑信息</legend>
				<form action="${tempProject.id != null ? 'edit.do' : 'add.do'}" method="post" target="frmright">
				<input type="hidden" name="id" value="${tempProject.id}">
				<input type="hidden" name="addDate" value="${tempProject.addDate}">
				<input type="hidden" name="type" value="${tempProject.type}">
				<table width="100%">
				<tr><td>标题:</td><td><input type="text" name="title" style="width:500px" value="${tempProject.title}"></td></tr>
				<tr><td>年份:</td><td><input type="text" name="year" class="date" dateFmt="yyyy" value="${tempProject.year}"/></td></tr>
				<tr><td>地区:</td><td><input type="text" name="location"  value='${tempProject.location }'></td></tr>
				<tr><td valign="top">内容:</td>
				<td>
					<script type="text/plain" id="editor" style="width:720px">${tempProject.content }</script>
				</td></tr>
				<tr><td valign="top">图片:</td>
					<td>
					<div class="imgBox">
						<div id="imgList">
							<c:forEach items="${tempProject.images}" var="image">
								<div><img src="${image.url}"/><span>${image.imgName}</span>
									<p onclick="removeImg($(this))"><img src="../../images/close.png"/></p>
									<input type="hidden" name="imgNameList" value="${image.imgName}">
									<input type="hidden" name="imgURLList" value="${image.url}">								
								</div>
							</c:forEach>
						</div>
						<div style="text-align: center;clear:both"><input type="button" onclick="startLoad()" value="上传图片"/></div>
					</div>
					</td>
				</tr>
				
				<tr><td colspan="2" align="center"><input type="submit" value=" 提 交 "/>&nbsp;&nbsp;<input type="button" onclick="$('#context').text('')" value=" 重 置 "/></td></tr>
				</table>
				</form>
			</fieldset>
		</div>
	</div>
</body>
<script type="text/javascript">
    var editor = new UE.ui.Editor();
    editor.render('editor');
    var contextPath="${pageContext.request.contextPath}";
	function startLoad(){
		var url=contextPath+"/servlet/FileUploadServlet.htm"; //处理上传的servlet
		var sizeLimit="1 MB";// 文件的大小  注意: 中间要有空格
		var types="*.jpg;*.jpeg;*.gif"; //注意是 " ; " 分割 
		var typesdesc="web iamge file"; //这里可以自定义
		var uploadLimit=20;  //上传文件的 个数
		initSwfupload(url,sizeLimit,types,typesdesc,uploadLimit);
	}
	function removeImg(obj){
		obj.parent().remove();
	}
</script>
</html>